{% extends 'base.html' %}
{% from 'bootstrap/pagination.html' import render_pagination %}

{% block title %}
    首页
{% endblock %}

{% block content %}
    {% if current_user.is_authenticated %}
        <div class="row justify-content-md-center">
            <div class="col-md-8">
                {#  部分展示文章为一条一条 #}
                {% include 'main/_posts.html' %}
                {% if posts %}
                    {# 展示分页 #}
                    <div class="page-footer">{{ render_pagination(pagination) }}</div>
                {% endif %}
            </div>
            <div class="col-sm-4 sidebar">
                {#   右上角展示链接与分类#}
                {% include 'main/_sidebar.html' %}
            </div>
        </div>
    {% else %}
        {#   未登录展示的部分    #}
        <div class="jumbotron">
            <div class="row">
                <div class="col-md-8">
                    <img src="{{ url_for('static', filename='images/index.jpeg') }}" class="rounded img-fluid">
                </div>
                <div class="col-md-4 align-self-center">
                    <h1>蓝客</h1>
                    <p>专注于技术开发的小白,追求技术永不过时!</p>
                    <p><a class="btn btn-primary btn-lg" href="{{ url_for('auth.register') }}">注册</a></p>
                </div>
            </div>
        </div>
    {% endif %}

{% endblock %}
